package date_;

import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Scanner;

/**
 * 6月的第3个星期日是父亲节，由用户输入年份，算出该年的父亲节是哪一天
 */
public class DateTest07 {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        System.out.println("输入月份");
        int year=input.nextInt();
        Calendar cal = Calendar.getInstance();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日 E");
        cal.set(Calendar.YEAR,year);
        cal.set(Calendar.MONTH,5);
        int count=0;
        for (int i = 0; ; i++) {
            if (cal.get(Calendar.DAY_OF_WEEK)==1){
                count++;
            }  if (count==2){
                String format = simpleDateFormat.format(cal.getTime());
                System.out.println(format);
                return;
            }
            cal.set(Calendar.DATE,cal.get(Calendar.DATE)+1);
        }


    }
}
